<?php
namespace app\admin\controller;
use app\admin\model\StoreUser as StoreUserModel;

/**
 * 商户管理控制器
 */
class Store extends Controller
{
    /**
     * 商户列表
     */
    public function index()
    {
		$model = new StoreUserModel;
		if (!$this->request->isAjax()) {
			$list = $model->getList();
			return $this->fetch('index', compact('list'));
		}
		//测试判断
		if($this->admin['user']['config_id']==0){
			return $this->renderError('测试用户不可操作');
		}
		// 公众号一键同步用户
		if ($model->wechat()) {
			return $this->renderSuccess('同步成功', url('store/index'));
		}
		$error = $model->getError() ?: '同步失败';
		return $this->renderError($error);
    }
}
